import React, { useCallback } from 'react';
import { NavBar } from 'antd-mobile';
import { history } from 'umi';
import styles from './index.less';

interface NavBarItemProps {
  title: string;
}

const NavBarItem: React.FC<NavBarItemProps> = ({ title }) => {
  const back = useCallback(() => {
    history.goBack();
  }, [history]);

  return (
    <div>
      <NavBar onBack={back} className={styles.shopCarTitle}>
        {title}
      </NavBar>
    </div>
  );
};

export default NavBarItem;
